<template>
	<view class="content">
		<view class="topBar f-c-c f30">
			<view class="arrowLeft" @click="$back(1)">
				<u-icon size="40" name="arrow-left"></u-icon>
			</view>
			<view class="fw">{{topBarTitle}}</view>
			<view @click="show=true" class="release cw f25" v-show="type==2">
				发布
			</view>
		</view>

		<view >
			<view v-for="(item,index) in dataList" class="item" @click="$to(`../product_detail/product_detail`)">
				<view class="item-left">
					<image :src="$u.baseUrl+item.coverimg" mode="widthFix"></image>
				</view>
				<view class="item-right">
					<view class="title">
						{{item.name}}
					</view>
					<view class="price_browse f-c-b f30">
						<view class="price">
							<text class="f40">￥{{item.price}}</text>
						</view>
						<view class="views f25 c6">
							浏览：{{item.views}}人
						</view>
					</view>
				</view>
			</view>
		</view>
		
		<u-modal @confirm='$to(`../userAuthentication/userAuthentication`)' confirm-color='#F57808' confirm-text='继续' width='550' v-model="show" :content="content" :show-cancel-button='true' :content-style="{fontSize:'35rpx',color:'#464646',}" ></u-modal>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				topBarTitle: '',
				dataList:[],
				show:false,
				content:'需要实名认证才可以发布 是否继续？',
				type:0
			}
		},
		methods: {
			async classifyGoods(id){
				const {success,data,msg}=await this.$u.api.classifyGoods({id})
				success?this.dataList=data:this.$u.toast(msg)
				
			}
		},
		onLoad(e) {
			this.topBarTitle = e.title
			this.type=e.type
			this.classifyGoods(e.parentId)
		}
	}
</script>

<style>
	.topBar {
		height: 80rpx;
		background-color: #FFFFFF;
	}

	.arrowLeft {
		position: absolute;
		left: 20rpx;
	}
	.release{
		position: absolute;
		right: 20rpx;
		background-color: #FF8710;
		border-radius: 30rpx;
		padding: 5rpx 20rpx;
	}
	
	.content{
		height: 100vh;
		background-color: #F6F6F6;
	}
	.item{
		background-color: #FFFFFF;
		margin: 20rpx 0;
		padding: 20rpx;
		display: flex;
		align-items: center;
	}
	.item-left image{
		width: 160rpx;
	}
	.item-right{
		margin: 0 25rpx;
	}
	.price_browse{
		margin-top: 20rpx;
	}
	.price{
		color: #FF2929;
	}
	.views{
		position: absolute;
		right: 30rpx;
	}
</style>
